GBML manual / Events

animation_end

Runs the frame `frame` wraps past `sprite`’s last frame back to the start.

Syntax

animation_end: fires the frame `frame` wraps past the last frame of `sprite`

Description

Runs the frame frame wraps from sprite's last frame back to the start - once per full loop of the sprite's own animation, not once per drawn frame. It fires when the animation frame_speed runs goes past the last frame, at any speed (0.25 and 0.5 included). Setting frame yourself never fires it. While the game is paused it does not run either, because the animation is holding still (Project Settings, Stop animations on pause, which is ticked in every project).

The usual use is a one-shot animation that should trigger something else the instant it finishes playing through once - an attack that deals its damage on the last frame, or a death animation that destroys the instance once it has fully played.

For an object that plays named animations it also runs when a loop comes round again, a play-once animation reaches its end, or a back-and-forth comes back to its first frame, and animation_ended_name says which animation it was.

Example

instance_destroy(self);

Destroys this instance once its death animation has played all the way through.

On the GBA

Fires from the animation frame_speed runs (any speed, fractions included); setting `frame` by hand never fires it.

See also: frameframe_countframe_speedEventsAnimationsanimation_ended_name